<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
  PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd">
<topic id="topic1">
  <title id="mb20941">gpmemwatcher</title>
  <body>
    <p>Tracks the memory usage of each process in a Greenplum Database cluster.</p>
    <section id="section2">
      <title>Synopsis</title>
      <codeblock>gpmemwatcher [-f | --host_file &lt;hostfile>]   
        
gpmemwatcher --stop [-f | --host_file &lt;hostfile>]  

gpmemwatcher --version

gpmemwatcher -h | --help</codeblock>
    </section>
    <section id="section3">
      <title>Description</title>
      <p>The <codeph>gpmemwatcher</codeph> utility is a daemon that runs on all servers of a
        Greenplum Database cluster. It tracks the memory usage of each process by collecting the
        output of the <codeph>ps</codeph> command every 60 seconds. It is a low impact process that
        only consumes 4 MB of memory. It will generate approximately 30 MB of data over a 24-hour
        period. </p>
      <p>You may use this utility if Greenplum Database is reporting <codeph>Out of memory</codeph>
        errors and causing segments to go down or queries to fail. You collect the memory usage
        information of one or multiple servers within the Greenplum Database cluster with
          <codeph>gpmemwatcher</codeph> and then use <xref href="./gpmemreport.xml#topic1"
          type="topic" format="dita"/> to analyze the files collected.</p>
    </section>
    <section id="section4">
      <title>Options</title>
      <parml>
        <plentry>
          <pt>-f | --host_file <varname>hostfile</varname></pt>
          <pd>Indicates the <varname>hostfile</varname> input file that lists the hosts from which the
            utility should collect memory usage information. The file must include the
            hostnames and a working directory that exists on each one of the hosts. For
            example:<codeblock>mdw:/home/gpadmin/gpmemwatcher_dir/working
sdw1:/home/gpadmin/gpmemwatcher_dir/working
sdw2:/home/gpadmin/gpmemwatcher_dir/working
sdw3:/home/gpadmin/gpmemwatcher_dir/working
sdw4:/home/gpadmin/gpmemwatcher_dir/working</codeblock></pd>
        </plentry>
        <plentry>
          <pt>--stop</pt>
          <pd>Stops all the <codeph>gpmemwatcher</codeph> processes, generates <codeph>.gz</codeph>
            data files in the current directory, and removes all the work files from all the
            hosts.</pd>
        </plentry>
        <plentry>
          <pt>--version</pt>
          <pd>Displays the version of this utility.</pd>
        </plentry>
        <plentry>
          <pt>-h | --help</pt>
          <pd>Displays the online help.</pd>
        </plentry>
      </parml>
    </section>
    <section id="section5"><title>Examples</title>
      <p><b>Example 1: Start the utility specifying the list of hosts from which to collect the
          information</b></p>
      <p>Create the file <codeph>/home/gpadmin/hostmap.txt</codeph> that contains the following:</p>
      <codeblock>mdw:/home/gpadmin/gpmemwatcher_dir/working
sdw1:/home/gpadmin/gpmemwatcher_dir/working
sdw2:/home/gpadmin/gpmemwatcher_dir/working
sdw3:/home/gpadmin/gpmemwatcher_dir/working
sdw4:/home/gpadmin/gpmemwatcher_dir/working</codeblock>
      <p>Make sure that the path <codeph>/home/gpadmin/gpmemwatcher_dir/working</codeph> exists on
        all hosts.</p>
      <p>Start the utility:</p>
      <codeblock>$ gpmemwatcher -f /home/gpadmin/hostmap.txt</codeblock>
      <p><b>Example 2: Stop utility and dump the resulting into a <codeph>.gz</codeph> file</b></p>
      <p>Stop the utility you started in Example 1:</p>
      <codeblock>$ gpmemwatcher -f /home/gpadmin/hostmap.txt --stop</codeblock>
      <p>The results <codeph>.gz</codeph> files will be dumped into the directory where you are
        running the command:</p><codeblock>$ [gpadmin@gpdb-m]$ ls -thrl
-rw-rw-r--. 1 gpadmin gpadmin 2.8K Nov 19 15:17 mdw.ps.out.gz
-rw-rw-r--. 1 gpadmin gpadmin 2.8K Nov 19 15:17 sdw1.ps.out.gz
-rw-rw-r--. 1 gpadmin gpadmin 2.8K Nov 19 15:17 sdw2.ps.out.gz
-rw-rw-r--. 1 gpadmin gpadmin 2.8K Nov 19 15:17 sdw3.ps.out.gz
-rw-rw-r--. 1 gpadmin gpadmin 2.8K Nov 19 15:17 sdw4.ps.out.gz</codeblock>
    </section>
    <section id="section6">
      <title>See Also</title>
      <p><xref href="./gpmemreport.xml#topic1" type="topic" format="dita"/></p>
    </section>
  </body>
</topic>
